<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <jsp:include page="/public/inc/head.jsp"/>
</head>
<body>
<div id="header" class="navbar navbar-static-top" role="navigation">
    <jsp:include page="/public/inc/top.jsp"/>
</div>
<div class="container-fluid" style="margin-top:5px;margin-bottom:60px;">
    <div class="row">
        <jsp:include page="/public/inc/menu.jsp"/>
        <div class="col-xs-12 col-sm-10">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <div class="media">
                        <div class="media-body">
                            <span class="glyphicon glyphicon-list"></span> 编辑
                        </div>
                        <div class="media-right">
                            <a href="/system/wwdx_comment/list" class="btn btn-primary">
                                <span class="glyphicon glyphicon-plus"></span> 返回
                            </a>
                        </div>
                    </div>
                </div>
                <div class="panel-body">
                    <form id="form3" action="/system/wwdx_comment/save" method="post" enctype="multipart/form-data">
                        <input type="hidden" value="${model.userid}" name="userid">
                        <input type="hidden" value="${model.productId}" name="productId">
                        <input type="hidden" value="${model.type}" name="type">
                        <input type="hidden" value="${model.editType}" name="editType">
                        <input type="hidden" value="${model.id}" name="id">
                        <div class="form-horizontal">
                            <div class="form-group">
                                <c:choose>
                                    <c:when test="${model.editType eq 1}">
                                        <input type="hidden" value="${model.content}" name="content">
                                        <input type="hidden" value="${model.status}" name="status">
                                        <input type="hidden" value="${model.recommend}" name="recommend">
                                        <label class="control-label col-md-2">修改时间</label>
                                        <div class="col-md-3">
                                            <fmt:formatDate value="${model.gmtCreated}" pattern="yyyy-MM-dd HH:mm:ss" var="time"/>
                                            <input class="form-control" readonly id="gmtCreated" name="gmtCreated" value="${time}" placeholder="格式:2000-08-08" />
                                        </div>
                                    </c:when>
                                    <c:otherwise>
                                        <div class="col-md-12" style="height: 7%">
                                            用户评论：${model.content}
                                        </div>
                                        <c:forEach var="l" items="${list}">
                                            <div class="col-md-12">
                                                回复信息:${l.content}
                                            </div>
                                        </c:forEach>
                                        <label class="control-label col-sm-1">回复</label>
                                        <div class="col-md-11">
                                            <textarea id="content" name="content" style="width:100%;height: 100px"></textarea>
                                        </div>
                                    </c:otherwise>
                                </c:choose>
                            </div>
                            <div class="form-group">
                                <div class="col-md-offset-2 col-md-10">
                                    <button type="submit" class="btn btn-primary">
                                        <i class="fa fa-floppy-o"></i> 保存
                                    </button>
                                </div>
                            </div>
                        </div>
                        <script type="text/javascript">
                            $(document).ready(function () {
                                $('#gmtCreated').datetimepicker({
                                    language: "zh-CN",
                                    format: "yyyy-mm-dd hh:ii:ss",
                                    autoclose: true,
                                    startView: 'month',
                                    todayHighlight: true,
                                    showMeridian: true,
                                    todayBtn: true
                                });

                                $("#form3").bootstrapValidator({
                                    feedbackIcons: {
                                        valid: 'glyphicon glyphicon-ok',
                                        invalid: 'glyphicon glyphicon-remove',
                                        validating: 'glyphicon glyphicon-refresh'
                                    },
                                    fields: {
                                        content: {
                                            validators: {
                                                notEmpty: {
                                                    message: '不能为空'
                                                }
                                            }
                                        }
                                    }
                                });
                            });
                        </script>
                    </form>
                </div>
                <div class="panel-footer">
                    <p:pagination url="/system/wwdx_comment/list" total="${listSize}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/public/inc/bottom.jsp"/>
</body>
</html>